#' Online rolling skewness
#'
#' @param period rolling window period
#' @param type type of skewness
#' @param u upper quantile, only used when type is mc or quantile
#' @param eps1 floating point epsilon, only used when type is mc
#' @param eps2 min representable positive floating point, only used when type is mc
#'
#' @return a stateful function
#' @export
#'
new_rollskew <- function(period, type = c("G1", "np", "npw", "mc", "quantile"), u = 0.75, eps1 = 1e-14, eps2 = 1e-16)
{
  type = match.arg(type)
  switch(type,
        G1 = mk_online_func_x("rollskew_G1", period),
        np = mk_online_func_x("rollskew_np", period),
        npw = mk_online_func_xw("rollskew_npw", period),
        mc = mk_online_func_x("rollskew_mc", period, u, eps1, eps2),
        quantile = mk_online_func_x("rollskew_quantile", period, u))
}
